<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
require_once BASE_PATH . 'application/controllers/articulo' . EXT;

class Video extends Articulo {

    public function __construct() {
        parent::__construct();
        $this->load->model('videoDAO');
    }

    public function index($id = 1) {
        $articulo = $this->videoDAO->_findById($id);
        if (count($articulo) == 0)
            redirect('/');
        $this->itemDAO->setHit($id);
        /*
          Modulos
         */
        $relacionados = $this->videoDAO->findTagsById($id, array('limit' => array(0, 10)));
        /*
          Publicidad
         */
        $publicidadheader2 = $this->adsDAO->getAdsense("video_publicidadheaderright");
        $publicidadheader1 = $this->adsDAO->getAdsense("video_publicidadheaderleft");
        $publicidadboxbanner1 = $this->adsDAO->getAdsense("video_publicidadboxbanner1");
        $publicidadboxbanner2 = $this->adsDAO->getAdsense("video_publicidadboxbanner2");
        $publicidadfooterleft = $this->adsDAO->getAdsense("video_publicidadfooterleft");
        $publicidadfooterright = $this->adsDAO->getAdsense("video_publicidadfooterright");

        $correopass = $this->input->get('item');
        $data = array(
            "header" => array(
                "title" => "Video",
                "subtitle" => "",
                "description" => "",
                "correopass" => $correopass,
                "keywords" => "",
                "session" => $this->sessionDAO->getUser(),
                "publicidadheader2" => $publicidadheader2,
                "publicidadheader1" => $publicidadheader1,
            ),
            // Modulos
            "articulo" => $articulo,
            "relacionados" => $relacionados,
            // Publicidad
            "publicidadboxbanner1" => $publicidadboxbanner1,
            "publicidadboxbanner2" => $publicidadboxbanner2,
            "publicidadfooterleft" => $publicidadfooterleft,
            "publicidadfooterright" => $publicidadfooterright,
        );
        $this->load->view('video/video', $data);
    }

}